package model.commands.mouse;

import model.commands.AbstractCommand;
import model.commands.ScreenPointCommand;

public class MouseMove extends AbstractCommand implements ScreenPointCommand{

	private Integer[] params;

	@Override
	public void execute() {
		try {
			if(params != null){
				robot.mouseMove(params[0], params[1]);
			}
			propertyChangeSupport.firePropertyChange(EXECUTION_FINISHED, null, this);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	@Override
	public void setParams(Object[] params) {
		try{
			this.params = new Integer[2];
			this.params[0] = Integer.parseInt(params[0].toString());
			this.params[1] = Integer.parseInt(params[1].toString());
		}catch(Exception e){
			e.printStackTrace();
			this.params = null;
		}
	}
	
	@Override
	public Integer getX() {
		return params[0];
	}

	@Override
	public Integer getY() {
		return params[1];
	}

}
